import { http } from '../../utils/net.js'

Page({
  data: {
    bank: null,
    plan: null,
    details: null
  },
  confirmPlan() {
    http({
      url: "/api/index/index?method=confirm_plan",
      data: {
        id: this.data.plan.order_id
      },
      isShowLoading: true,
      successCb: (res) => {
        wx.showToast({
          title: res.msg,
        })
        setTimeout(() => {
          wx.navigateTo({
            url: `/pages/refundLookAt/index?refundId=${this.data.plan.order_id}`
          })
        }, 500)
      }
    })
  },
  onLoad: function (options) {
    const eventChannel = this.getOpenerEventChannel()
    let that = this
    eventChannel.on('acceptDataFromOpenerPage', function (data) {
      console.log("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++")
      console.log(data)
      that.setData({
        bank: data.data.bank,
        plan: data.data.plan,
        details: data.data.details
      })
    })
  }
})